import { CellRenderer } from "../../../../../fl/controls/listClasses/CellRenderer";
import { ResouceConst } from "../../../../component/gconst/ResouceConst";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { ObjCreate } from "../../common/ObjCreate";
import { GuildScoreData } from "../cellData/GuildScoreData";
import { ColorConfig } from "../../../resource/ColorConfig";
import { ScaleBitmap } from "../../../../../com/mui/display/ScaleBitmap";
//class GuildScoreCellRenderer
    
    export  class GuildScoreCellRenderer extends CellRenderer
    {
        constructor()
        {
            super();
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            this.initStyle();
            this.createChildren();
            this.addListeners();
            return;
        }

        /* internal  */initStyle(): void
        {
            this.setStyle("downSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("overSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("upSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedDownSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedOverSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedUpSkin", new Object /* flash.display.Bitmap */());
            return;
        }

        /* internal  */createChildren(): void
        {
            this._line = ResouceConst.getScaleBitmap("SplitLine");
            this._line.width = 460;
            this._line.height = 2;
            this.addChild(this._line);
            var loc1=new GTextFormat(FontUtil.songtiName, 12, 11661311);
            loc1.align = flash.text.TextFormatAlign.CENTER;
            this._tfRank = ObjCreate.createTextField("", 0, 8, 70, 20, this, loc1);
            this._tfGuildName = ObjCreate.createTextField("", 70, 8, 120, 20, this, loc1);
            this._tfJoinNum = ObjCreate.createTextField("", 190, 8, 100, 20, this, loc1);
            this._tfGuildScore = ObjCreate.createTextField("", 290, 8, 100, 20, this, loc1);
            this._tfBattleScore = ObjCreate.createTextField("", 390, 8, 70, 20, this, loc1);
            return;
        }

        /* internal  */addListeners(): void
        {
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            if (typeof arg1 === "guildscoredata") 
            {
                this._scoreData = arg1 as GuildScoreData;
                this.updateView();
            }
            return;
        }

        /* internal  */updateView(): void
        {
            var loc1=new GTextFormat(FontUtil.songtiName, 12, ColorConfig.instance.getCampColor(this._scoreData.guildWarGuildScore.camp).intColor);
            this._tfRank.text = this._scoreData.rank.toString();
            this._tfGuildName.text = this._scoreData.guildWarGuildScore.guildName;
            this._tfJoinNum.text = this._scoreData.guildWarGuildScore.guildPlayerNum.toString();
            this._tfGuildScore.text = this._scoreData.guildWarGuildScore.mark.toString();
            this._tfBattleScore.text = this._scoreData.guildWarGuildScore.battleMark.toString();
            return;
        }

        public /* override */ set label(arg1: string)
        {
            return;
        }

        /* internal */ /* var */_line: ScaleBitmap;

        /* internal */ /* var */_tfRank: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfGuildName: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfJoinNum: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfGuildScore: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfBattleScore: Object /* flash.text.TextField */;

        /* internal */ /* var */_scoreData: GuildScoreData;
    }
